using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace TR0217.ControlEx
{
    internal class HSLColorSlider : ColorSlider
    {
        HSLColor _selectedColor = new HSLColor();
        public HSLColor SelectedHSLColor
        {
            get { return _selectedColor; }
            set
            {
                if (_selectedColor == value)
                    return;
                _selectedColor = value;
                value.Lightness = 0.5;
                Color2 = Color.FromArgb(255, value.Color);
                Percent = (float)_selectedColor.Lightness;
                Refresh();//Invalidate(Util.Rect(BarRectangle));
            }
        }

        protected override void SetPercent(PointF mousepoint)
        {
            base.SetPercent(mousepoint);
            _selectedColor.Lightness = Percent;
            Refresh();
        }
        protected override void SetPercent(float percent)
        {
            base.SetPercent(percent);
            _selectedColor.Lightness = percent / 100;
            SelectedHSLColor = _selectedColor;
        }
    }
}
